<script>
function solution(string) {
  return string.replace(/[A-Z]/g, function(match) {
    return '-' + match.toLowerCase()
  })
}

// function solution(string) {
//   return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
// }

console.log(solution('camelACasingTest'))

</script>